<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>新增基地页面</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        .discell {
            text-align:right;
        }
        .input {
            width:200px;
        }
    </style>
</head>
<body>
<form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
    <!-- 编辑框START-->
    <div id="editform" class="form mini-fit" style="margin:10px 0 40px;">
        <input id="id" name="id" class="mini-hidden" style="width: 100%;" value="${id!''}" />
        <input id="keanzhirenshu" name="keanzhirenshu" class="mini-hidden" style="width: 100%;" value="${keanzhirenshu!''}" />
        <table class="form-table" align="center" cellspacing="8">
            <tr>
                <td class="discell"><font color="#dc143c">*</font>可安置人员数量:</td>
                <td>
                    <input id="jdrs" type="number" name="jdrs" min="1" style="width: 150px" required="true" value="${keanzhirenshu!''}" />人
                </td>
        </table>
    </div>
    <!--编辑框END-->
    <div style="position: absolute;bottom: 0;line-height: 40px;width: 100%;border-top:1px solid #dfdfdf;text-align: center">
        <a class="mini-button" iconCls="fa-save" plain="true" onclick="saveData()">确认</a>
        <a class="mini-button" iconCls="fa-close" plain="true" onclick="onCancel()">取消</a>
    </div>
</form>

<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");

    function saveData() {
        //验证非空字段
        form.validate();
        if (form.isValid() == false) {
            return;
        }
        var id = mini.get("id").getValue();
        var jdrs = document.getElementById("jdrs").value;
        var keanzhirenshu = mini.get("keanzhirenshu").getValue();
        var data = form.getData();
        data.jdrs = jdrs;
        var json = mini.encode(data);
        if (parseInt(keanzhirenshu) > jdrs) {
            mini.alert("新增人数不可小于原基地人数");
            return;
        }
        commonSaveData("/azbj/jdxxgl/placementJd/saveNum", {data: json}, callback);

        // 保存成功的回调函数
        function callback() {
            mini.alert("保存成功", "成功", window.CloseOwnerWindow);
        }

    }
</script>
</body>
</html>